<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../resources/css/bootstrap.min.css"/>
		<link rel="stylesheet" href="http://www.xyshopping.com:8848/qianduan/resources/css/back.css" />
		<script src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-heima-0.0.1.js" ></script>
		<title>商品列表</title>
		<style type="text/css">
			.prod_tr{
				text-align: center;
			}
			.prod_tr:hover{
				background-color: white;
			}
			
		</style>
		<script>
			$(function(){
				//直接发请求
				var pageNumber = HM.getParameter("pageNumber") == null ? 1 : HM.getParameter("pageNumber");
				HM.ajax("/product?md=findAll","pageNumber="+pageNumber, function(vo){
					var pb = vo.data;
					var products = pb.data;
					for(var i = 0; i < products.length; i++){
						var classx = i%2 == 0 ? "tr_odd prod_tr" : "tr_even prod_tr"
						var tr = "<tr class='"+classx+"'>\n" +
							"\t\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t\t"+(i+1)+"\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t\t"+products[i].pname+"\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t\t<td align=\"left\" >\n" +
							"\t\t\t\t\t\t\t\t\t\t"+products[i].pdesc+"\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t\t"+products[i].shop_price+"\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t\t\t"+(products[i].is_hot == 1 ? "是" : "否")+"\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t\t<img width=\"40\" src=\"http://www.xyshopping.com:8848/qianduan/"+products[i].pimage+"\">\n" +
							"\t\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t</tr>"
							
							$("#productlist").append(tr);
							var html = HM.page(pb,"http://www.xyshopping.com:8848/qianduan/view/admin/product/list.html");
							$(".pagination").html(html);
					}
				})
			})
		</script>
	</head>
	<body>
		<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
				<tbody>
					<tr>
						<td  align="center" bgColor="#afd1f3">
							<strong>商品列表</strong>
						</TD>
					</tr>
					<tr>
						<td  align="right">
							<a href="add.html" target="mainFrame">添加</a>
						</td>
					</tr>
					<tr>
						<td  align="center" bgColor="#f5fafe">
							<table cellspacing="0" cellpadding="1" bordercolor="gray" border="1" style=" WIDTH: 100%; WORD-BREAK: break-all;BORDER-COLLAPSE: collapse; WORD-WRAP: break-word">
								<thead>
								<tr style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3;text-align: center;">
									<td width="7%">
										序号
									</td>
									<td  width="10%">
										商品名称
									</td>
									<td  width="47%">
										商品描述
									</td>
									<td  width="17%">
										商品价格
									</td>
									<td  width="10%">
										是否热门
									</td>
									<td  >
										商品图片
									</td>
									
								</tr>
								</thead>
								<tbody id="productlist">
									
								</tbody>
						</td>
					</tr>
					<tr align="center">
						<td colspan="7">
								<ul class="pagination" style="text-align:center; margin-top:10px;">
									
								</ul>
						</td>
					</tr>
				</tbody>
			</table>
	</body>
</html>
